'''
Function:
    A learnable scale parameter
Author:
    Zhenchao Jin
'''
import numpy as np
import luojianet
from luojianet import nn, ops, Parameter, Tensor
from luojianet.common.initializer import initializer, Constant
from luojianet.common import initializer as init
import luojianet.ops as ops


'''Scale'''
class Scale(nn.Module):
    def __init__(self, scale=1.0):
        super(Scale, self).__init__()
        # self.scale = nn.Parameter(torch.tensor(scale, dtype=torch.float))
        # self.scale = Parameter(initializer(Constant(scale), channels, luojianet.float32))
        self.scale = Parameter(Tensor(scale, dtype=luojianet.float32))
    '''forward'''
    def forward(self, x):
        return x * self.scale